import { CYCLEARR, DAYARR } from "@/utils/constant";

//周期展示
export function getJobCycleString(row, desc = "") {
  let time = "";
  if (row.jobCycle === "1") {
    time = row.cycleTime;
  } else if (row.jobCycle === "2") {
    time = row.cycleDay;
  } else if (row.jobCycle === "3") {
    time = DAYARR[row.weekDay] + "/" + row.cycleWeek;
  } else if (row.jobCycle === "4") {
    time = row.monthDay + "号/" + row.cycleMonth;
  } else if (row.jobCycle === "5") {
    time = row.quarterDay + " " + row.cycleQuarter;
  } else if (row.jobCycle === "6") {
    time = row.yearDay + " " + row.cycleYear;
  }

  return executionCycleTypeFn(row.jobCycle) + desc + "/" + time;
}

export function executionCycleTypeFn(value) {
  let label = "";
  CYCLEARR.map((v) => {
    if (v.value === value) {
      label = v.label;
    }
  });
  return label;
}
